#ifndef CBASE_H
#define CBASE_H
#include "BCESDK_UI.h"


class CBASE
{
public:
	CBASE();
	~CBASE();

private:
	void *m_hDll;
	bool Load();
	void Unload();
public:
	//BASE
	void Freelibrary();

	typedef long (*P_BCESDK_Init)();


	//basic
	typedef long (*P_BCESDK_Init)();
	typedef long (*P_BCESDK_InitEx)(BCESDK_CbkFunc *pFunc);
	typedef long (*P_BCESDK_UnInit)();

	typedef long (*P_BCESDK_GetSofewareVersion)(/*out*/wchar_t *name);

	typedef long (*P_BCESDK_GetLocalName)(/* out */ wchar_t* name,/* in/out */ unsigned int len);
	typedef long (*P_BCESDK_SetLocalName)( /* in */ wchar_t* name);
	typedef long (*P_BCESDK_GetDefaultPinCode)(/* out */ char* pincode, /* in/out */ unsigned int *plen);
	typedef long (*P_BCESDK_SetDefaultPinCode)( /* in */ char* pincode, /* in */ unsigned int len);
	typedef long (*P_BCESDK_GetLocalBTAddr)( /* Out*/ unsigned char *bd_addr);
	typedef long (*P_BCESDK_GetModuleString)(/* out */wchar_t *szModuleString);

	typedef long (*P_BCESDK_DeviceDiscovery)( /* in */ BCESDK_DeviceDiscovery_CbkFunc *pDeviceDiscovery_CbkFunc );
	typedef long (*P_BCESDK_StopDiscovery)();
	typedef long (*P_BCESDK_RegisterConnectCallback)( /* in */ BCESDK_DeviceConnect_CbkFunc *pDeviceConnect_CbkFunc );
	typedef long (*P_BCESDK_RegisterPairCallback)( /* in */ BCESDK_DevicePair_CbkFunc *pDevicePair_CbkFunc );
	typedef void (*P_BCESDK_SetPairable)(bool bPairable);
	typedef long (*P_BCESDK_PairDevice)( /* in */ unsigned char *bd_addr );
	typedef long (*P_BCESDK_UnPairDevice)( /* in */unsigned char*bd_addr );
	typedef bool (*P_BCESDK_IsPairDevice)( /* in */ unsigned char *bd_addr );

	typedef long (*P_BCESDK_GetRemoteServices)(/* in */ unsigned char *bd_addr, /* out */ PBCESDK_RemoteServiceAttrStru pServiceAttrStru, /* in/out */ unsigned int  *svc_count);
	typedef long (*P_BCESDK_GetRemoteName)(/* in */ unsigned char *bd_addr, /* out */wchar_t *name);
	typedef long (*P_BCESDK_Connect)( /* in */ unsigned char* bd_addr, /* in */ short svc_class );
	typedef long (*P_BCESDK_ConnectEx)( /* in */ unsigned char* bd_addr, /* in */ short svc_class,  /* in */ LPVOID lParameter);
	typedef long (*P_BCESDK_Disconnect)( /* in */ unsigned char* bd_addr, /* int */ short svc_class );
	typedef bool (*P_BCESDK_IsConnected)( /* in */ unsigned char* bd_addr, /* int */ short svc_class );
	typedef long (*P_BCESDK_GetAllShortCuts)(/* out */PBCESDK_ShortcutInfoStru pShortcutList, /* in/out */unsigned int *pListCount);
	typedef long (*P_BCESDK_DeleteShortCut)(/* in */unsigned char* bd_addr);

	typedef void (*P_BCESDK_EnableAutoConnectHF)();
	typedef void (*P_BCESDK_DisableAutoConnectHF)();
	typedef bool (*P_BCESDK_IsAutoConnectHF)();
	typedef long (*P_BCESDK_BindA2DPToHF)();
	typedef long (*P_BCESDK_UnbindA2DPFromHF)();

	//handfree
	typedef long (*P_BCESDK_HFAP_RegisterCallback)(/* in */HWND hWndReceive,/* in */BCESDK_HandsFree_CbkFunc *pHandsFree_CbFunc);;
	typedef long (*P_BCESDK_HFAP_AnswerCall)();
	typedef long (*P_BCESDK_HFAP_CancelCall)();
	typedef long (*P_BCESDK_HFAP_Dial)(/* in */char* phone_num, /* in */unsigned int len);
	typedef long (*P_BCESDK_HFAP_LastNumRedial)();
	typedef long (*P_BCESDK_HFAP_TransmitDTMFCode)(/* in */char chr);
	typedef long (*P_BCESDK_HFAP_GetAudioStatus)();
	typedef long (*P_BCESDK_HFAP_Transfer)();
	typedef long (*P_BCESDK_HFAP_TransferBack)();
	typedef void (*P_BCESDK_HFAP_MuteMic)();
	typedef void (*P_BCESDK_HFAP_UnmuteMic)();

	typedef void (*P_BCESDK_EnableAutoAnswer)();
	typedef void (*P_BCESDK_DisableAutoAnswer)();
	typedef bool (*P_BCESDK_IsAutoAnswer)();

	//PIM
	typedef long (*P_BCESDK_PIMStartUpdateContacts)( /* in */ PBCESDK_PhoneInfo pPhoneInfo);
	typedef long (*P_BCESDK_PIMRegisterCallback)( /* in */ BCESDK_PIMUpdateResult_CbFunc *pUadateResult_CbFunc);
	typedef long (*P_BCESDK_PIMGetOppContacts)(/* out */PBCESDK_OPPPerson pOppperson, unsigned int *pCount);
	typedef long (*P_BCESDK_PIMGetContacts)( /* out */PBCESDK_ContactInfo pContacts, /* in/out */unsigned int *pCount);
	typedef long (*P_BCESDK_PIMStartUpdateCalllog)();
	typedef long (*P_BCESDK_PIMGetCalllogs)(/* out */PBCESDK_CalllogInfo pCalllogs, /* in/out */unsigned int *pCount);
	typedef long (*P_BCESDK_GetPhoneList)(/* out */PBCESDK_PhoneInfo pPhoneList, /* in/out */unsigned int *pListCount);
	typedef long (*P_BCESDK_PIMDisconnect)();

	//A2DP&AVRCP
	typedef long (*P_BCESDK_RegPassThrCmdCbk)(/* in */BCESDK_PassThrCmdCbFunc *pFunc);
	typedef long (*P_BCESDK_AVRCPPlay)( );
	typedef long (*P_BCESDK_AVRCPPause)( );
	typedef long (*P_BCESDK_AVRCPStop)( );
	typedef long (*P_BCESDK_AVRCPPlayLast)( );
	typedef long (*P_BCESDK_AVRCPPlayNext)( );
	typedef long (*P_BCESDK_AVRCPVolumeUP)( );
	typedef long (*P_BCESDK_AVRCPVolumeDown)( );
	typedef void (*P_BCESDK_A2DP_SNK_DisablePlay)( ); //Mute A2DP snk
	typedef void (*P_BCESDK_A2DP_SNK_EnablePlay)( ); //UnMute A2DP snk
	typedef long (*P_BCESDK_AVRCPForcePlay)( );
	typedef long (*P_BCESDK_AVRCPForcePause)( );
	typedef long (*P_BCESDK_EnalbeA2DP)();
	typedef long (*P_BCESDK_DisableA2DP)();
	typedef bool (*P_BCESDK_IsA2DPEnable)();

	//DUN
	typedef long (*P_BCESDK_DUNGetCountry)(/* out */PBCESDK_DunCountryInfo pCountry, /* in/out */unsigned int *pCount);
	typedef long (*P_BCESDK_DUNGetProvider)( /* in */unsigned int nCountryId,/* out */PBCESDK_DunProviderInfo pProvider,/* in/out */unsigned int *pCount);

	//SPP
	typedef int (*P_BCESDK_GetClientPort)();

	//FTP
	typedef long (*P_BCESDK_FTPGetRemoteFileList)(/* in */wchar_t *path,/* in */BCESDK_FTP_UIShowBrowseFile *BrowFileListCallBackFun,/* in */unsigned int op_type);
	typedef long (*P_BCESDK_FTPDownLoadFile)(/* in */wchar_t *rmt_file,/* in */wchar_t *new_file);
	typedef long (*P_BCESDK_FTPDownLoadDir)(/* in */wchar_t *rmt_dir,/* in */wchar_t *new_dir);
	typedef long (*P_BCESDK_FTPPutFile)(/* in */wchar_t *Loc_file,/* in */wchar_t *new_file);
	typedef long (*P_BCESDK_FTPPutDir)(/* in */wchar_t *loc_dir,/* in */wchar_t *new_dir);
	typedef long (*P_BCESDK_FTPNewFolder)(/* in */wchar_t *new_dir);
	typedef long (*P_BCESDK_FTPDeleteFile)(/* in */wchar_t *szFile);
	typedef long (*P_BCESDK_FTPDeleteDir)(/* in */wchar_t *szDir);
	typedef long (*P_BCESDK_FTPSetRmtDir)(/* in */wchar_t *szDir);
	typedef long (*P_BCESDK_FTPGetRmtDir)(/* out */wchar_t *szDir);
	typedef long (*P_BCESDK_FTPCancelTransfer)();
	typedef void (*P_BCESDK_FTPRegisterStatusCallback)( /* in */BCESDK_FTP_STATUS_INFO_CB *func);
	typedef long (*P_BCESDK_GetDefaultPath)(/* out */ wchar_t* d_path);
	typedef long (*P_BCESDK_SetDefaultPath)( /* in */ wchar_t* d_path);

	typedef long (*P_BCESDK_GetSavePath)(/* out */ wchar_t* szPath);
	typedef long (*P_BCESDK_GetLastConnectedHFDevice)(unsigned char* bd_addr);
	typedef long (*P_BCESDK_GetLastConnectedAVDevice)(unsigned char* bd_addr);
	//opp server
	typedef long (*P_BCESDK_PIMGetOppContacts)(PBCESDK_OPPPerson pOppperson, unsigned int *pCount);
	//opp client
	typedef long (*P_BCESDK_OPPPushContact)( /* in */unsigned char *bd_addr, /* in */PBCESDK_ContactInfo pOPPContacts); 


	//BASE
	P_BCESDK_Init                     BCESDK_Init;
	P_BCESDK_InitEx					  BCESDK_InitEx;
	P_BCESDK_UnInit                   BCESDK_UnInit;
	P_BCESDK_GetSofewareVersion       BCESDK_GetSofewareVersion;
	P_BCESDK_GetDefaultPinCode        BCESDK_GetDefaultPinCode;
	P_BCESDK_SetDefaultPinCode        BCESDK_SetDefaultPinCode;
	P_BCESDK_GetLocalName             BCESDK_GetLocalName;
	P_BCESDK_SetLocalName             BCESDK_SetLocalName;
	P_BCESDK_GetLocalBTAddr           BCESDK_GetLocalBTAddr;
	P_BCESDK_DeviceDiscovery          BCESDK_DeviceDiscovery;
	P_BCESDK_StopDiscovery            BCESDK_StopDiscovery;
	P_BCESDK_SetPairable              BCESDK_SetPairable;
	P_BCESDK_PairDevice               BCESDK_PairDevice;
	P_BCESDK_IsPairDevice             BCESDK_IsPairDevice;
	P_BCESDK_UnPairDevice             BCESDK_UnPairDevice;
	P_BCESDK_GetRemoteName            BCESDK_GetRemoteName;
	P_BCESDK_GetRemoteServices        BCESDK_GetRemoteServices;
	P_BCESDK_Connect                  BCESDK_Connect;
	P_BCESDK_ConnectEx                BCESDK_ConnectEx;
	P_BCESDK_Disconnect               BCESDK_Disconnect;
	P_BCESDK_IsConnected              BCESDK_IsConnected;
	P_BCESDK_RegisterConnectCallback  BCESDK_RegisterConnectCallback;
	P_BCESDK_RegisterPairCallback     BCESDK_RegisterPairCallback;
	P_BCESDK_GetAllShortCuts          BCESDK_GetAllShortCuts;
	P_BCESDK_DeleteShortCut           BCESDK_DeleteShortCut;
	P_BCESDK_GetModuleString          BCESDK_GetModuleString;

	P_BCESDK_EnableAutoConnectHF      BCESDK_EnableAutoConnectHF;
	P_BCESDK_DisableAutoConnectHF     BCESDK_DisableAutoConnectHF;
	P_BCESDK_IsAutoConnectHF		  BCESDK_IsAutoConnectHF;

	//HF
	P_BCESDK_HFAP_RegisterCallback    BCESDK_HFAP_RegisterCallback;
	P_BCESDK_HFAP_AnswerCall          BCESDK_HFAP_AnswerCall;
	P_BCESDK_HFAP_CancelCall          BCESDK_HFAP_CancelCall;
	P_BCESDK_HFAP_Dial                BCESDK_HFAP_Dial;
	P_BCESDK_HFAP_LastNumRedial		  BCESDK_HFAP_LastNumRedial;
	P_BCESDK_HFAP_TransmitDTMFCode    BCESDK_HFAP_TransmitDTMFCode;
	P_BCESDK_HFAP_GetAudioStatus      BCESDK_HFAP_GetAudioStatus;
	P_BCESDK_HFAP_Transfer            BCESDK_HFAP_Transfer;
	P_BCESDK_HFAP_TransferBack        BCESDK_HFAP_TransferBack;
	P_BCESDK_HFAP_MuteMic			  BCESDK_HFAP_MuteMic;
	P_BCESDK_HFAP_UnmuteMic           BCESDK_HFAP_UnmuteMic;

	P_BCESDK_EnableAutoAnswer		  BCESDK_EnableAutoAnswer;
	P_BCESDK_DisableAutoAnswer		  BCESDK_DisableAutoAnswer;
	P_BCESDK_IsAutoAnswer			  BCESDK_IsAutoAnswer;
	P_BCESDK_BindA2DPToHF             BCESDK_BindA2DPToHF;
	P_BCESDK_UnbindA2DPFromHF         BCESDK_UnbindA2DPFromHF;

	//PhoneBook
	P_BCESDK_PIMStartUpdateContacts   BCESDK_PIMStartUpdateContacts;
	P_BCESDK_PIMRegisterCallback      BCESDK_PIMRegisterCallback ;
	P_BCESDK_PIMGetContacts           BCESDK_PIMGetContacts;
	P_BCESDK_PIMStartUpdateCalllog    BCESDK_PIMStartUpdateCalllog;
	P_BCESDK_PIMGetCalllogs           BCESDK_PIMGetCalllogs;
	P_BCESDK_GetPhoneList             BCESDK_GetPhoneList; 
	//A2DP

	P_BCESDK_AVRCPPlay                BCESDK_AVRCPPlay;   
	P_BCESDK_AVRCPPause               BCESDK_AVRCPPause;
	P_BCESDK_AVRCPStop                BCESDK_AVRCPStop;
	P_BCESDK_AVRCPPlayLast            BCESDK_AVRCPPlayLast;
	P_BCESDK_AVRCPPlayNext            BCESDK_AVRCPPlayNext;
	P_BCESDK_AVRCPVolumeUP            BCESDK_AVRCPVolumeUP;
	P_BCESDK_AVRCPVolumeDown          BCESDK_AVRCPVolumeDown;
	P_BCESDK_RegPassThrCmdCbk         BCESDK_RegPassThrCmdCbk;
	P_BCESDK_A2DP_SNK_DisablePlay     BCESDK_A2DP_SNK_DisablePlay;
	P_BCESDK_A2DP_SNK_EnablePlay      BCESDK_A2DP_SNK_EnablePlay;
	P_BCESDK_AVRCPForcePlay			  BCESDK_AVRCPForcePlay;
	P_BCESDK_AVRCPForcePause		  BCESDK_AVRCPForcePause;
	P_BCESDK_EnalbeA2DP				  BCESDK_EnalbeA2DP;
	P_BCESDK_DisableA2DP			  BCESDK_DisableA2DP;
	P_BCESDK_IsA2DPEnable             BCESDK_IsA2DPEnable;
	//DUN
	P_BCESDK_DUNGetCountry            BCESDK_DUNGetCountry;
	P_BCESDK_DUNGetProvider           BCESDK_DUNGetProvider;

	//SPP
	P_BCESDK_GetClientPort            BCESDK_GetClientPort;

	//FTP
	P_BCESDK_FTPGetRemoteFileList     BCESDK_FTPGetRemoteFileList;
	P_BCESDK_FTPDownLoadFile          BCESDK_FTPDownLoadFile;
	P_BCESDK_FTPDownLoadDir           BCESDK_FTPDownLoadDir;
	P_BCESDK_FTPNewFolder             BCESDK_FTPNewFolder;
	P_BCESDK_FTPSetRmtDir             BCESDK_FTPSetRmtDir;
	P_BCESDK_FTPGetRmtDir             BCESDK_FTPGetRmtDir;
	P_BCESDK_FTPPutFile               BCESDK_FTPPutFile;
	P_BCESDK_FTPPutDir                BCESDK_FTPPutDir;
	P_BCESDK_FTPDeleteFile            BCESDK_FTPDeleteFile;
	P_BCESDK_FTPDeleteDir             BCESDK_FTPDeleteDir;
	P_BCESDK_FTPCancelTransfer        BCESDK_FTPCancelTransfer;
	P_BCESDK_FTPRegisterStatusCallback  BCESDK_FTPRegisterStatusCallback;
	P_BCESDK_SetDefaultPath           BCESDK_SetDefaultPath;
	P_BCESDK_GetDefaultPath           BCESDK_GetDefaultPath;

	//Other
	P_BCESDK_GetSavePath			  BCESDK_GetSavePath;
	P_BCESDK_GetLastConnectedHFDevice BCESDK_GetLastConnectedHFDevice;
	P_BCESDK_GetLastConnectedAVDevice BCESDK_GetLastConnectedAVDevice;
	//opp
	P_BCESDK_PIMGetOppContacts        BCESDK_PIMGetOppContacts;
	//opp client
	P_BCESDK_OPPPushContact           BCESDK_OPPPushContact;
};
extern CBASE gbase;

#endif 